package kr.saeildamil.androidstudty.ch09;

import kr.saeildamil.androidstudty.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

public class OptionMenuXml extends Activity {
	TextView tv;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		tv = new TextView(this);
		tv.setText("메뉴 키를 선택");
		setContentView(tv);
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		getMenuInflater().inflate(R.menu.ch09_option, menu);
		return true;
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		super.onOptionsItemSelected(item);
		switch (item.getItemId()) {
		case R.id.jjajang:
			tv.setText("짜장을 선택");
			return true;
		case R.id.jjambbong:
			tv.setText("짬뽕을 선택");
			return true;
		case R.id.udong:
			tv.setText("우동을 선택");
			return true;
		case R.id.mandoo:
			tv.setText("만두를 선택");
			return true;
		}
		return false;
	}
}
